<style>
    .panel-statistics h4 {
        color: #666;
        font-weight: bold;
        font-size: 14px;
    }

    .panel-statistics h3 {
        font-weight: 500;
        font-size: 12px;
        color: #333;
    }
    .panel-statistics h3 span {
        font-size: 30px;
    }

    .panel-statistics em {
        font-style: normal;
    }

    .panel-statistics .pull-right {
        padding-right: 10px;
    }

    .panel-statistics .table thead tr th {
        font-weight: normal;
    }

    .panel-statistics .table tbody tr td {
        font-weight: normal;
        vertical-align: middle;
    }

    .panel-statistics .table tbody tr td p {
        margin: 0;
    }

    #echarts1 textarea {
        display: block;
    }

    select.model_id {
        min-width: 60px;
    }
    .nav > li > a {
        padding: 5px 5px 0px 5px;
    }
    .panel-intro > .panel-heading .nav-tabs > li > a {
        margin-right: 0;
        color: #0d0d0d;
    }
    .fixed-table-toolbar{
        display: none;
    }
    .progress-bar {
        color: #020202;
        background-image: linear-gradient(to right, #4969e6, #1ac6f2);
    }
    .level1{
        background-color: #777777;
    }
    .level2{
        background-color: #2c3e50;
    }
    .level3{
        background-color: #3498db;
    }
    .level4 {
        background-color: #f39c12;
    }
    .level5 {
        background-color: #d62c1a;
    }
    .status-1{
        background-color: #777777;
    }
    .status0{
        background-color: #2c3e50;
    }
    .status1{
        background-color: #18bc9c;
    }
    .status2 {
        background-color: #e74c3c;
    }
    .status3 {
        background-color: #18bc9c;
    }
    .panel-intro{
        border: 1px solid #ddd;
    }
    .list-group-item{
        border: unset;
        padding: 5px 0px;
    }
    .logcontent{
        min-width: 150px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width:300px;
    }
</style>

<div class="panel panel-default">
    <div class="panel-heading">

        <span class="label status{$row.status}">{$statusList[$row.status]}</span>
        <span class="label label-info">{$row.padmin.nickname}</span>

        <span class="pull-right" >
            {if $auth->check('workteam/project/edit')}
            <a href="workteam/project/edit/ids/{$row['id']}" class="btn-dialog" data-title="{:__('修改项目')}"><i class="fa fa-pencil"></i>
                {$row.name}
            </a>
            {else/}
            {$row.name}
            {/if}
        </span>
        <span class="label level{$row.level} pull-right"> {$levelList[$row.level]}</span>
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-xs-6">
                <ul class="list-group">
                    <li class="list-group-item  text-left">
                        <span>     {:__("项目编号")}： {$row.number}</span>
                    </li>
                    <li class="list-group-item">
                        {:__("作业内容")}：
                        {php}$row['jobs']=explode(',',$row['jobs']);{/php}
                        {volist name="w_config['jobs']" id="item" }
                        {if in_array($key,$row['jobs'])}
                            {$item},
                        {/if}
                        {/volist}
                    </li>

                    <li class="list-group-item text-left">
                        <span> {:__("客户名称")}：</span>
                        {$row.customer_name}

                    </li>
                    <li class="list-group-item">{:__("联系人")}：{$row.contacts_name}</li>
                    <li class="list-group-item">
                        <span>     {:__("下单日期")}：
                            {:datetime($row.order_time,'Y/m/d')}
                        </span>


                    </li>
                    <li class="list-group-item">{:__("始止日期")}：{:datetime($row.start_time,'Y/m/d H:s')}~{:datetime($row.end_time,'Y/m/d H:s')}</li>
                    <li class="list-group-item">{:__("初稿时间")}：  {:datetime($row.test_time,'Y/m/d H:s')}</li>



                </ul>
            </div>
            <div class="col-xs-6">
                <ul class="list-group">
                    <li class="list-group-item">{:__("创建时间")}：{:datetime($row.create_time,'Y/m/d H:s')}</li>
                    <li class="list-group-item">{:__("完成时间")}：{:$row.complete_time?datetime($row.complete_time,'Y/m/d H:s'):'-'}</li>
                    <li class="list-group-item">{:__("业务经理")}：   {$row.cadmin.nickname}</li>
                    <li class="list-group-item">{:__("参与人数")}：

                        {:$row.admin_ids?count(explode(',',$row.admin_ids)):'0'}{:__("人")}
                    </li>
                    <li class="list-group-item">
                        <span style="width: 140px;">{:__("附件")}：
                            {php}
                            $files_count=$row->files()->count()>0;
                            {/php}
                            {if $files_count>0 }
                            <a href="workteam/project/fileslist/project_id/{$row->id}" data-title="{$row.name}{:__('附件')}" class="btn-dialog"> 点击查看</a>
                            {else/}
                            无
                            {/if}
                        </span>

                    </li>
                    <li class="list-group-item">{:__("备注")}：  {$row.remark}</li>

                </ul>
            </div>
            <div class="col-xs-12">
                {$row.content}
            </div>

        </div>
    </div>
</div>

<div class="row">
    <div class="col-xs-6 col-sm-3">
        <div class="panel panel-default panel-intro panel-statistics">
            <div class="panel-body">
                <div class="pull-left">
                    <h4>{:__("项目进度")}{:$row.plan_hours>=$row.task_hours?'':"(".__('超').")"}</h4>
                    <h3>
                        {php}
                         $total_hours=$row['plan_hours']>=$row['task_hours']?$row['plan_hours']:$row['task_hours'];
                        {/php}
                        <span class="text-{:$row.plan_hours>=$row.task_hours?'success':'danger'}" data-toggle="tooltip" data-title="{:__('完成工时')}：{$row.actual_hours}">
                            {:sprintf('%.2f',$row.actual_hours/$total_hours*100)}</span>
                        <em  class="text-gray">(%)</em>


                    </h3>
                    <div style="color: rgb(153, 153, 153); font-size: 1.2rem;">
                        {:__('安排')}：{$row.task_hours}(h)
                        <em data-toggle="tooltip" data-title="{:__('完成工时')}：{$row.actual_hours}"
                            class="text-{:$row.plan_hours>=$row.task_hours?'success':'danger'}">
                            {:__('计划')}{$row.plan_hours}(h)</em>
                    </div>
                </div>

                <div class="pull-right" style="color:#c8cfff;">
                    <i class="fa fa-clock-o fa-2x"></i>
                </div>
            </div>
        </div>
    </div>
    <div class="col-xs-6 col-sm-3">
        <div class="panel panel-default panel-intro panel-statistics">
            <div class="panel-body">
                <div class="pull-left">
                    <h4>{:__("任务数量")}</h4>
                    <h3>
                        <span class="text-{:$row.task_count==$row.task_complate?'success':'danger'}">{$row.task_count}</span>
                        <em  class="text-gray"></em>
                    </h3>
                    <div style="color: rgb(153, 153, 153); font-size: 1.2rem;">
                        {:__('完成')}：{$row.task_complate}
                    </div>
                </div>

                <div class="pull-right" style="color:#ffc8c8;">
                    <i class="fa fa-calendar fa-2x"></i>
                </div>


            </div>
        </div>
    </div>
    <div class="col-xs-6 col-sm-3">
        <div class="panel panel-default panel-intro panel-statistics">
            <div class="panel-body">

                <div class="pull-left">
                    <h4 >{:__("逾期任务")}</h4>
                    <h3>
                        {php}
                        $taskModel = new  \app\admin\model\workteam\Task();
                        $time=time();
                        $uncomplate=$taskModel->where('project_id',$row['id'])->where('end_time','<',$time)->where('status','in',[1,0])->count();
                        {/php}
                        <span class="text-{:$uncomplate==0?'success':'danger'}">{$uncomplate}</span>
                        <em  class="text-gray"></em>
                    </h3>
                    <div style="color: rgb(153, 153, 153); font-size: 1.2rem;">
                        {:__('请及时完成任务')}
                    </div>
                </div>

                <div class="pull-right" style="color:#{:$uncomplate==0?'18bc9c':'d62c1a'};">
                    <i class="fa fa-info-circle fa-2x"></i>
                </div>


            </div>
        </div>
    </div>
    <div class="col-xs-6 col-sm-3">
        <div class="panel panel-default panel-intro panel-statistics">
            <div class="panel-body">

                <div class="pull-left">
                    <h4>{:__("延误率")}</h4>
                    <h3>
                        {php}
                        $delay_count=0;
                        if($row['task_count']>0){
                            $delay_count=$taskModel->where('project_id',$row['id'])->where(function($query){
                            $query->where('complete_time>`end_time`')->whereOr('`complete_time` IS NULL AND unix_timestamp(now())>end_time');
                            })->where('status','in',[1,0,2])->fetchSql(false)->count();
                            $delay_percentage=$delay_count==0?0:sprintf('%.2f',($delay_count/$row['task_count']*100));
                        }else{
                            $delay_percentage=0;
                        }

                        {/php}
                        <span class="text-{:$delay_percentage==0?'success':'danger'}">{$delay_percentage}</span>
                        <em  class="text-gray">(%)</em>

                    </h3>
                    <div style="color: rgb(153, 153, 153); font-size: 1.2rem;">
                        {:__('延误数量')}：{$delay_count}
                    </div>
                </div>

                <div class="pull-right" style="color:#c8e3ff;">
                    <i class="fa fa-refresh fa-2x"></i>
                </div>

            </div>
        </div>
    </div>

</div>
<div class="row" style="margin-top:20px;">
    <div class="col-xs-12 col-sm-6">

        <div class="panel panel-default panel-intro">

            <div class="panel-heading">

                <span class="label label-primary pull-right" style="margin-left: 5px">{:__('任务')}</span>
                <a href="javascript:;" data-url="{:url('workteam/task/add',['ids'=>$row['id']])}" class="label label-success  btn-addtask pull-right" title="{:__('添加主任务')}">
                    <i class="fa fa-plus"></i> {:__("添加")}
                </a>
                <ul class="nav nav-tabs" id="tab-my-task" >



                    <li class='active'>
                        <a  href="#t-1" data-filter='' data-op='' data-toggle="tab">{:__('全部')}</a>
                    </li>

                    <li><a  href="#t-2" data-filter='{"status":"1,0"}' data-op='{"status":"in"}' data-toggle="tab">{:__('未完成')}</a></li>
                    <li><a  href="#t-3" data-filter='{"start_time":"{:date("Y-m-d 00:00:00", time())} - {:date("Y-m-d 23:59:59", time())}"}'
                             data-op='{"start_time":"RANGE"}' data-toggle="tab">{:__('今日')}</a></li>
                    {php}
                    $start_week= date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")));
                    $end_week= date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")));

                    {/php}
                    <li><a  href="#t-4" data-filter='{"start_time":"{$start_week} - {$end_week}"}'
                             data-op='{"start_time":"RANGE"}' data-toggle="tab">{:__('本周')}</a></li>
                    <li><a  href="#t-5" data-filter='{"end_time":"{:time()}","status":"1,0"}'
                             data-op='{"end_time":"<","status":"in"}' data-toggle="tab">{:__('逾期')}</a></li>
					<li>
                        <a  href="{:url('workteam/project/gantt',['project_id'=>$row['id']])}" title="甘特图:{$row.name}"   class="btn-addtabs">{:__('甘特图')}</a></li>
					<li>
                        <a  href="#t-999" data-filter='{"status":"1,0"}' data-op='{"status":"in"}' data-toggle="tab" data-idnum="1">{:__('燃尽图')}</a></li>

                </ul>

            </div>

            <div class="panel-body">
                <div  class="tab-content">
                    <div class="tab-pane fade active in task-box" id="one">
                        <div class="widget-body no-padding" style="height: 600px;overflow: auto;">
                            <table id="tabletask" class="table table-striped table-bordered table-hover table-nowrap"
                                   data-operate-add="{:$auth->check('workteam/task/add')}"
                                   data-operate-edit="{:$auth->check('workteam/task/edit')}"
                                   data-operate-del="{:$auth->check('workteam/task/del')}"
                                   data-operate-addchild="{:$auth->check('workteam/task/addchild')}"
                                   data-operate-detail="{:$auth->check('workteam/task/detail')}"
                                   data-operate-start="{:$auth->check('workteam/task/start')}"
                                   data-operate-complete="{:$auth->check('workteam/task/complete')}"
                                   width="100%">
                            </table>
                        </div>
                    </div>
					<div class="tab-pane fade  in task-box" id="one1">
                        <div class="widget-body no-padding" style="height: 600px;overflow: auto;">
                            <div id="yjt-echats" style="height:600px;"></div>

                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>
    <div class="col-xs-12 col-sm-6">

        <div class="panel panel-default panel-intro">

            <div class="panel-heading">
                <ul class="nav nav-tabs" id="tab-customer-log"  >

					<a href="javascript:;" data-url="{:url('service/log/add',['customer_id'=>$row['customer_id'],'project_id'=>$row['id']])}" class="label label-success  btn-add-customer-log pull-right" title="{:__('添加客情记录')}">
						<i class="fa fa-plus"></i> {:__("添加")}
					</a>
                    <li class='active'>
                        <a  href="#t-1" data-filter='' data-op='' data-toggle="tab">客情记录</a></li>
                </ul>

            </div>

            <div class="panel-body">
                <div  class="tab-content">
                    <div class="tab-pane fade active in" >
                        <div class="widget-body no-padding" style="height: 600px;overflow: auto;">
                            <table id="table-customer-log" class="table table-striped table-bordered table-hover table-nowrap"
							   data-operate-edit1="{:$auth->check('service/log/edit')}"
							   data-operate-del1="{:$auth->check('service/log/del')}"
							   width="100%">
                            </table>

                        </div>
                    </div>

                </div>
            </div>

        </div>

    </div>
</div>

<div class="row" style="margin-top:20px;">
    <div class="col-xs-12 col-sm-6">

        <div class="panel panel-default panel-intro">

            <div class="panel-heading">


                <span class="label label-primary pull-right" style="margin-left: 5px">{:__('项目动态')}</span>
                <a href="javascript:;"  data-url="{:url('workteam/project/addlog',['ids'=>$row['id']])}" class="label label-success  btn-addlog pull-right" title="{:__('添加项目动态')}">
                    <i class="fa fa-plus"></i> {:__("添加")}
                </a>
                <ul class="nav nav-tabs" id="tab-log" >

					<li class="active"><a  href="#t-0" data-filter='' data-op='' data-toggle="tab">{:__('全部')}</a></li>
	                {foreach name="typeList" item="vo" key="key"}
					<li><a  href="#t-{$key}" data-filter='{"type":"{$key}"}' data-op='{"type":"="}' data-toggle="tab">{$vo}</a></li>
					{/foreach}

                </ul>

            </div>

            <div class="panel-body">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade active in" >
                        <div class="widget-body no-padding" style="height: 640px;overflow: auto;">
                            <table id="tablelog" class="table table-striped table-bordered table-hover table-nowrap"
                                   width="100%">
                            </table>
                        </div>
                    </div>

                </div>
            </div>

        </div>

    </div>
    <div class="col-xs-12 col-sm-6">

        <div class="panel panel-default panel-intro">

            <div class="panel-heading">
                <span class="label label-primary pull-right">{:__('项目成员')}</span>
                <ul class="nav nav-tabs" id="tab-my-project"  >

                    <li class='active'>
                        <a  href="#t-1" data-filter='' data-op='' data-toggle="tab">{:__('列表')}</a></li>
                </ul>

            </div>

            <div class="panel-body">
                <div  class="tab-content">
                    <div class="tab-pane fade active in" >
                        <div class="widget-body no-padding" style="height: 640px;overflow: auto;">
                            <table id="tableadmins" class="table table-striped table-bordered table-hover table-nowrap"

                                   width="100%">
                            </table>
                        </div>
                    </div>

                </div>
            </div>

        </div>

    </div>
</div>

<script>
    var dataEchart = {:json_encode($dataEchart)};

    var project_id={:input('ids')}
</script>